load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel/proto:rules.bzl", "write_go_proto_srcs")

proto_library(
    name = "initproto_proto",
    srcs = ["init.proto"],
    visibility = ["//visibility:public"],
    deps = ["//internal/versions/components:components_proto"],
)

go_proto_library(
    name = "initproto_go_proto",
    compilers = ["@io_bazel_rules_go//proto:go_grpc"],
    gc_goopts = ["-trimpath=$(BINDIR)=>."],
    importpath = "github.com/edgelesssys/constellation/v2/bootstrapper/initproto",
    proto = ":initproto_proto",
    visibility = ["//visibility:public"],
    deps = ["//internal/versions/components"],
)

go_library(
    name = "initproto",
    embed = [":initproto_go_proto"],
    importpath = "github.com/edgelesssys/constellation/v2/bootstrapper/initproto",
    visibility = ["//visibility:public"],
)

write_go_proto_srcs(
    name = "write_generated_protos",
    src = "init.pb.go",
    go_proto_library = ":initproto_go_proto",
    visibility = ["//visibility:public"],
)
